
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-9">
            <div class="tabs-container">
                <ul class="nav nav-tabs" id="tab-list-2">
                    <li class="links active" id="search-link"><a href="#search" role="tab" data-toggle="tab">Search</a></li>
                </ul>
                <div class="tab-content">
                   <div id="search" class="tab-pane active">
                        <div class="panel-body">
                             
                                  <div class="ibox-title" style="border:none;"><h5 style="color: #00afef"><i>Arrear Summary</i></h5>
                                  </div>
                                     <div class="ibox-content">
                                          
                                         <table style="width:100%;align:center;" class="table-bordered table-compact" id="reports">
                                          <thead>
                                            <tr>
                                              <th>Area</th>
                                              <th>Active Service </th>
                                              <th>Arrear Count(2)</th>
                                              <th>Arrear Count(3)</th>
                                              <th>Arrear Count(4)</th>
                                              <th>Arrear Count(5+)</th>
                                              <th>Arrear TOTAL</th>
                                            </tr>
                                          </thead>
                                          <tbody id="tbod">
                                            <?php 
                                            $c2t= 0;$c3t= 0;$c4t= 0;$c5up = 0; $tac=0;
                                            foreach ($arrear_data as $ad) { $total=0;?>
                                              <tr>
                                                <td><input type="hidden" value="<?php echo $ad->area; ?>" id="z1"><?php echo $ad->area; ?></td>
                                                <td style="text-align:right;"><?php echo $ad->actives; $tac = $tac + $ad->actives; ?></td>
                                                <td style="text-align:right;"><a class="btn btn-link open_arear" id="2" style=" padding: 0px;color: #1ab7f0; text-align: right;"><?php echo $ad->c2; $total = $total + $ad->c2; $c2t=$c2t+$ad->c2; ?></a></td>
                                                <td style="text-align:right;"><a class="btn btn-link open_arear" id="3" style=" padding: 0px;color: #1ab7f0; text-align: right;"><?php echo $ad->c3; $total = $total + $ad->c3; $c3t=$c3t+$ad->c3; ?></a></td>
                                                <td style="text-align:right;"><a class="btn btn-link open_arear" id="4" style=" padding: 0px;color: #1ab7f0; text-align: right;"><?php echo $ad->c4; $total = $total + $ad->c4; $c4t=$c4t+$ad->c4; ?></a></td>
                                                <td style="text-align:right;"><a class="btn btn-link open_arear" id="5" style=" padding: 0px;color: #1ab7f0; text-align: right;"><?php echo $ad->above4; $total = $total + $ad->above4; $c5up=$c5up+$ad->above4;?></a></td>
                                                <td style="text-align:right;"><?php echo $total; ?></td>
                                              </tr>
                                            <?php } ?>
                                              <tr>
                                                <td>TOTAL:</td>
                                                <td style="text-align:right;"><?php echo $tac; ?></td>
                                                <td style="text-align:right;"><?php echo $c2t; ?></td>
                                                <td style="text-align:right;"><?php echo $c3t; ?></td>
                                                <td style="text-align:right;"><?php echo $c4t; ?></td>
                                                <td style="text-align:right;"><?php echo $c5up; ?></td>
                                                <td style="text-align:right;"><?php echo $c2t+$c3t+$c4t+$c5up; ?></td>
                                              </tr>
                                          </tbody>
                                        </table>
                                      </div>
                                 
                          
                            
                              
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div><!-- END of class row-->
</div>
 <script type="text/javascript">
  $(document).ready(function(){
    $(".chosen-select").chosen({width:"100%;"});
      $(document).on('click','.open_arear',function(){
          var cnt =$(this).attr('id');
          var zone =$(this).closest('tr').find('#z1').val();
           console.log(zone+'-'+cnt); 
          var title = 'Arrear List';
          var url = '<?php echo base_url($this->session->userdata('forajax')); ?>/get_pend?id='+cnt+'&zone='+zone;
          window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no');
        });

  });
 </script>